ConnectivityListener

Interface for receiving notifications about changes in network connectivity status.

A class that needs to react to changes in internet connection status should implement this interface. An object of such a class can then be registered with a component responsible for monitoring network connectivity (e.g., using an addConnectivityListener method on that component). When a change in connectivity is detected, the onConnectivityChanged method of the listener will be invoked.

This listener is primarily used to inform parts of the application whether an active internet connection is available, allowing them to adapt their behavior accordingly (e.g., attempt to sync data, switch to offline mode, or display a notification to the user).

See also

<YourConnectivityMonitorClass> // Replace if you have a specific class that manages/triggers these events

Functions

Link copied to clipboard
abstract fun onConnectivityChanged(isConnected: Boolean)
Invoked when the device's internet connectivity status changes.